package com.survey.application.action;

import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.interceptor.SessionAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;
import com.survey.application.bean.Survey;
import com.survey.application.bean.User;
import com.survey.application.service.SurveyService;
@Controller
@Scope("prototype")
public class SurveyAction extends ActionSupport implements ModelDriven<Survey>,SessionAware,Preparable {
	private User user;
	private Map<String,Object> session;
	@Resource
	private SurveyService surveyService;
	public String add(){
		return "add";
	}
	public String save(){
		surveyService.save(survey);
		return "save";
	}
	private  Survey survey=new Survey();
	@Override
	public Survey getModel() {
		survey=new Survey();
		return survey;
	}
	@Override
	public void setSession(Map<String, Object> session) {
		this.session=session;
	}
	@Override
	public void prepare() throws Exception {
		
	}

}
